<!--Form for updating an announcement to the database-->
<?php
session_start();
?>

<!--This is the UI for when the users have selected the activity to edit-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>Rotaract DLSU</title>
        <meta http-equiv="Content-Type" content="text/html"/>
        <meta name="robots" content="index,follow"/>
        <meta name="distribution" content="global"/>
        <meta name="description" content=""/>
        <meta name="keywords" content=""/>
        <link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
        <link rel="stylesheet" href="css/jquery-ui-1.8.21.custom.css"/>
        <link rel="stylesheet" href="css/demos.css"/>
        <script src="js/jquery-1.7.2.min.js"></script>
        <script src="js/jquery.ui.core.js"></script>
        <script src="js/jquery.ui.widget.js"></script>
        <script src="js/jquery.ui.datepicker.js"></script>

        <script>
            $(function() {
                $( "#datepicker" ).datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'yy-mm-dd'
                });
            });
        </script>

    </head>
    <body>
        <div id="container2">
            <div id="main2">
                <table width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="main_nav">
                            <div id="main_text2"> 
                                <center>
                                    <h2>Edit an Activity</h2>
                                    <form enctype = "multipart/form-data" name="imageUpload" action="RAC-editAgendaUI2.php" method="POST" >
                                        <?php
                                        include 'getAgenda.php';

                                        if (isset($confirm)) {
                                            echo "<br/>";
                                            echo "<h3>$confirm</h3>";
                                        }
                                        ?>
                                        <table border ="1" cellpadding="10" class="myTable">
                                            <br/>
                                            <br/>

                                            <?php
                                            while ($row = mysql_fetch_array($result)) {
                                                $idAgenda = $row['id'];
                                                $dateAgenda = $row['date'];
                                                $placeAgenda = $row['place'];
                                                $descAgenda = $row['desc'];
                                                $sTimeAgenda = $row['sTimeAgenda'];
                                                $eTimeAgenda = $row['eTimeAgenda'];
                                                
                                                echo "<input type='hidden' name='idAgenda' value='" . $idAgenda . "'/>";
                                               echo " <tr>";
                                                echo "<td><b>Place of Agenda</b></td>";
                                               echo " <td><input type='text' value='" . $placeAgenda . "' name='placeAgenda'/><label id='errorplace'></label></td>";
                                               echo " </tr> ";
                                              echo "  <tr>";
                                              echo "  <td><b>Date of Agenda</b></td>";
                                              echo "  <td><input type='text' value='" . $dateAgenda . "' name='dateAgenda' id='datepicker'/><label id='errordate'></label></td>";
                                              echo "  </tr>";
                                              echo " <tr>";
                                               echo " <td><b>Start Time of Agenda</b></td>";
                                              echo "  <td><input type='text' value='" . $sTimeAgenda. "' name='sTimeAgenda'/><label id='errorsTime'></label></td>";
                                              echo "  </tr>";
                                              echo "  <tr>";
                                              echo "  <td><b>End Time of Agenda</b></td>";
                                              echo "  <td><input type='text' value='" . $eTimeAgenda . "' name='eTimeAgenda'/><label id='erroreTime'></label></td>";
                                              echo "  </tr>";
                                              echo "  <tr>";
                                              echo "  <td><b>Description</b></td>";
                                              echo "  <td><input type='text' value='" . $descAgenda . "' name='descAgenda'/><label id='errordesc'></label></td>";
                                              echo "  </tr>";
                                            }
                                            ?>
                                        </table>
                                        <br/>
                                        <br/>

                                        <input type="submit" name="submitEdit" value="Save" onclick="confirm('Are you sure these values are correct?')"/>
                                    </form>
                                <?php
                                $confirm = '';
                                if (isset($_POST['submitEdit'])){
                                include 'RAC-editAgenda.php';
                                
                                if($confirm){
                                    echo "<h4>Edit Successful! Please refresh to see changes.</h4>";
                                }
                                }
                                ?>
                                </center>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </body>
</html>


